﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using SmartSiteManagementSystem.IServices;
using SmartSiteManagementSystem.IRepository.Equipment;
using SmartSiteManagementSystem.Models.Equipment;
using System.Linq;

namespace SmartSiteManagementSystem.Services
{
    public class EquipmentService : IEquipmentService
    {

        private readonly ITowerCraneInfoRepository _towerCraneInfoRepository;

        public EquipmentService(ITowerCraneInfoRepository towerCraneInfoRepository
           )
        {
            _towerCraneInfoRepository = towerCraneInfoRepository;

        }

        #region TowerCraneInfo

        /// <summary>
        /// 
        /// </summary>
        /// <param name="towerCraneId"></param>
        /// <returns></returns>
        public TowerCraneInfo GetTowerCraneInfoById(int towerCraneId)
        {
            Hashtable param = new Hashtable();
            param.Add("tower_crane_id", towerCraneId);
            return _towerCraneInfoRepository.Get(param);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="param"></param>
        /// <param name="orderBy"></param>
        /// <param name="first"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public IList<TowerCraneInfo> GetTowerCraneInfoList(Hashtable param, string orderBy, int first, int rows)
        {
            return _towerCraneInfoRepository.GetList(param, orderBy, first, rows);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public int GetTowerCraneInfoListCount(Hashtable param)
        {
            return _towerCraneInfoRepository.GetCount(param);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="towerCraneInfo"></param>
        /// <returns></returns>
        public int InsertTowerCraneInfo(TowerCraneInfo towerCraneInfo)
        {
            return _towerCraneInfoRepository.Insert(towerCraneInfo);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="towerCraneInfo"></param>
        /// <returns></returns>
        public bool UpdateTowerCraneInfo(TowerCraneInfo towerCraneInfo)
        {
            bool back = _towerCraneInfoRepository.Update(towerCraneInfo);
            return back;
        }

        


        #endregion

    }
}
